import requests from '@/api/request'
const SERVER_URL = ''
export default {
  // 查询
  postQueryOrgData (data) {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/queryByCondition`,
      method: 'post',
      data
    })
  },
  // 查询已开启的机构树
  getQueryOrgTree () {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/open/queryTree`,
      method: 'get'
    })
  },
  // 查询所有机构树
  getQueryOrgTree1 () {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/queryTree`,
      method: 'get'
    })
  },
  // 新增机构
  postAddOrgData (data) {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/add`,
      method: 'post',
      data
    })
  },
  // 编辑
  putEditOrgData (data) {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/edit`,
      method: 'put',
      data
    })
  },
  // 查询单条详情
  getOrgDetailData (data) {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/queryById/${data}`,
      method: 'get'
    })
  },
  // 机构关联用户
  // postOrgRelateUserData (data) {
  //   return requests({
  //     url: `${SERVER_URL}/v1/api/user/user/queryByCondition`,
  //     method: 'post',
  //     data
  //   })
  // },
  // 修改角色数据权限
  postChangeDataPermissionsData (data) {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/change/dataPermissions`,
      method: 'post',
      data
    })
  },
  // 停用角色
  postCloseOrgData (data) {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/close/${data}`,
      method: 'post'
    })
  },
  // 启用角色
  postOpenOrgData (data) {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/open/${data}`,
      method: 'post'
    })
  },
  // 删除角色
  deleteOrgData (data) {
    return requests({
      url: `${SERVER_URL}/v1/api/user/organization/delete/${data}`,
      method: 'delete',
      data
    })
  },
  // 根据机构id获取负责人
  getUserOrgList (data) {
    return requests({
      url: `/v1/api/user/user/find/by/org/id`,
      method: 'post',
      data
    })
  }
}
